#include "gui.h"
#include "renderwindow.h"
#include "threadpool.h"

#ifdef _DEBUG
#ifdef _MSC_VER
   #define new   new( _CLIENT_BLOCK, __FILE__, __LINE__)
#endif
#endif // _DEBUG

namespace Engine
{
	/**********************************************************************************************************/
	GUI::GUI()
		:m_startBtn(0)
		,m_optionsBtn(0)
		,m_quitBtn(0)
		,m_creditsBtn(0)
		,m_optionsWnd(0)
		,m_optionsOkBtn(0)
		,m_optionsNoBtn(0)
		,m_optionsResCombo(0)
		,m_optionsFSAACombo(0)
		,m_optionsFullScr(0)
		,m_optionsMultiT(0)
		,m_optionsShowStat(0)
		,m_statisticsWnd(0)
		,m_statisticsFPS(0)
		,m_statisticsFaces(0)
		,m_creditsWnd(0)
		,m_creditsText(0)
		,m_gameMenu(false)
	{
	}
	/**********************************************************************************************************/
	GUI::~GUI()
	{
		m_guisystem.Delete();
		m_guiRenderer.Delete();
	}
	/**********************************************************************************************************/
	void GUI::Init(LPDIRECT3DDEVICE9 device,RenderWindowPtr window,InputSystemPtr input)
	{
		m_input = input;
		m_window = window;

		m_guiRenderer = RefPtr<CEGUI::DirectX9Renderer>(new CEGUI::DirectX9Renderer(device, 300 ));

		m_xmlParser = RefPtr<CEGUI::TinyXMLParser>(new CEGUI::TinyXMLParser);
		m_guisystem = RefPtr<CEGUI::System>(new CEGUI::System( m_guiRenderer.GetPointer(), &m_guiManager, m_xmlParser.GetPointer() ));

#ifdef _DEBUG
		CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
#else
		CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Errors);
#endif

		registerAllFactories();

		CEGUI::FontManager::getSingleton().createFont("Commonwealth-10.font");

		CEGUI::Imageset* taharezImages = CEGUI::ImagesetManager::getSingleton().createImageset("TaharezLook.imageset");

		CEGUI::WidgetLookManager::getSingleton().parseLookNFeelSpecification("TaharezLook.looknfeel");

		CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLookWidgets.scheme");

		CEGUI::System::getSingleton().setDefaultMouseCursor(&taharezImages->getImage("MouseArrow"));

		CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
		CEGUI::DefaultWindow* root = (CEGUI::DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
		CEGUI::System::getSingleton().setGUISheet(root);

		m_startBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "StartGameBtn");
	    root->addChildWindow(m_startBtn);
		m_startBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.425f), cegui_reldim( 0.25f)));
		m_startBtn->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.05f)));
		m_startBtn->setText("Start Game");
		m_startBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnStartClick, this));

		m_optionsBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "OptionsBtn");
	    root->addChildWindow(m_optionsBtn);
		m_optionsBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.425f), cegui_reldim( 0.35f)));
		m_optionsBtn->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.05f)));
		m_optionsBtn->setText("Options");
		m_optionsBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnOptionsClick, this));


		m_quitBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "QuitBtn");
	    root->addChildWindow(m_quitBtn);
		m_quitBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.425f), cegui_reldim( 0.45f)));
		m_quitBtn->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.05f)));
		m_quitBtn->setText("Quit");
		m_quitBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnQuitClick, this));

		m_creditsBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "CreditsBtn");
	    root->addChildWindow(m_creditsBtn);
		m_creditsBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.425f), cegui_reldim( 0.55f)));
		m_creditsBtn->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.05f)));
		m_creditsBtn->setText("Credits");
		m_creditsBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnCreditsClick, this));


		//options window
	    m_optionsWnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "OptionsWnd");
	    root->addChildWindow(m_optionsWnd);
		m_optionsWnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
		m_optionsWnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
		m_optionsWnd->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
		m_optionsWnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
		m_optionsWnd->setText("Options");
		m_optionsWnd->setDragMovingEnabled(false);
		m_optionsWnd->setSizingEnabled(false);
		m_optionsWnd->setRollupEnabled(false);
		m_optionsWnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&GUI::OnOptionsNoClick, this));
		m_optionsWnd->hide();

		//OK button
		m_optionsOkBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "OptionsOkBtn");
	    m_optionsWnd->addChildWindow(m_optionsOkBtn);
		m_optionsOkBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.9f)));
		m_optionsOkBtn->setSize(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.07f)));
		m_optionsOkBtn->setText("Ok");
		m_optionsOkBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnOptionsOkClick, this));

		//Cancel button
		m_optionsNoBtn = (CEGUI::ButtonBase*)winMgr.createWindow("TaharezLook/Button", "OptionsNoBtn");
	    m_optionsWnd->addChildWindow(m_optionsNoBtn);
		m_optionsNoBtn->setPosition(CEGUI::UVector2(cegui_reldim(0.6f), cegui_reldim( 0.9f)));
		m_optionsNoBtn->setSize(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.07f)));
		m_optionsNoBtn->setText("Cancel");
		m_optionsNoBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUI::OnOptionsNoClick, this));

		//screen resolution
		CEGUI::Window* label = winMgr.createWindow("TaharezLook/StaticText", "Label1");
		m_optionsWnd->addChildWindow(label);
		label->setProperty("FrameEnabled", "false");
		label->setProperty("BackgroundEnabled", "false");
		label->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.15f)));
		label->setSize(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.1f)));
		label->setText("Resolution : ");

		m_optionsResCombo = (CEGUI::Combobox*)winMgr.createWindow("TaharezLook/Combobox", "OptionsScrRes");
	    m_optionsWnd->addChildWindow(m_optionsResCombo);
		m_optionsResCombo->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.15f)));
		m_optionsResCombo->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
		m_optionsResCombo->setReadOnly(true);
		// populate combobox with possible selection modes
		const CEGUI::Image* sel_img = &CEGUI::ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("MultiListSelectionBrush");
		RenderWindow::Resolutions resList = m_window->GetAvailableResolutions();
		RenderWindow::Resolutions::iterator i = resList.begin(), e = resList.end();
		for(;i != e; ++i)
		{
			std::stringstream buf;
			buf<<i->first<<"x"<<i->second;
			CEGUI::ListboxTextItem* itm = new CEGUI::ListboxTextItem(buf.str());
			itm->setSelectionBrushImage(sel_img);
			m_optionsResCombo->addItem(itm);
		}

		//antialising
		label = winMgr.createWindow("TaharezLook/StaticText", "Label2");
		m_optionsWnd->addChildWindow(label);
		label->setProperty("FrameEnabled", "false");
		label->setProperty("BackgroundEnabled", "false");
		label->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.3f)));
		label->setSize(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.1f)));
		label->setText("FSAA : ");

		m_optionsFSAACombo = (CEGUI::Combobox*)winMgr.createWindow("TaharezLook/Combobox", "OptionsFSAA");
	    m_optionsWnd->addChildWindow(m_optionsFSAACombo);
		m_optionsFSAACombo->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.3f)));
		m_optionsFSAACombo->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
		m_optionsFSAACombo->setReadOnly(true);
		// populate combobox with possible selection modes
		RenderWindow::FSAAModes aaList = m_window->GetAvailableFSAAModes();
		RenderWindow::FSAAModes::iterator iaa = aaList.begin(), eaa = aaList.end();
		for(;iaa != eaa; ++iaa)
		{
			std::stringstream buf;
			buf<<*iaa;
			CEGUI::ListboxTextItem* itm = new CEGUI::ListboxTextItem(buf.str());
			itm->setSelectionBrushImage(sel_img);
			m_optionsFSAACombo->addItem(itm);
		}

		//2 cores
		label = winMgr.createWindow("TaharezLook/StaticText", "Label3");
		m_optionsWnd->addChildWindow(label);
		label->setProperty("FrameEnabled", "false");
		label->setProperty("BackgroundEnabled", "false");
		label->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.45f)));
		label->setSize(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.1f)));
		label->setText("Threads : ");

		m_optionsMultiT = (CEGUI::Spinner*)winMgr.createWindow("TaharezLook/Spinner", "OptionsMultiT");
	    m_optionsWnd->addChildWindow(m_optionsMultiT);
		m_optionsMultiT->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.45f)));
		m_optionsMultiT->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.1f)));
		m_optionsMultiT->setMaximumValue(16);
		m_optionsMultiT->setMinimumValue(1);
		m_optionsMultiT->setCurrentValue(1);

		//fullscreen
		m_optionsFullScr = (CEGUI::Checkbox*)winMgr.createWindow("TaharezLook/Checkbox", "OptionsFullScr");
	    m_optionsWnd->addChildWindow(m_optionsFullScr);
		m_optionsFullScr->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.55f)));
		m_optionsFullScr->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.1f)));
		m_optionsFullScr->setText("FullScreen");

		//statistic
		m_optionsShowStat = (CEGUI::Checkbox*)winMgr.createWindow("TaharezLook/Checkbox", "OptionsShowStat");
	    m_optionsWnd->addChildWindow(m_optionsShowStat);
		m_optionsShowStat->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.65f)));
		m_optionsShowStat->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.1f)));
		m_optionsShowStat->setText("Show Statistic");

		m_releaseInput = (CEGUI::Checkbox*)winMgr.createWindow("TaharezLook/Checkbox", "ReleaseInput");
	    m_optionsWnd->addChildWindow(m_releaseInput);
		m_releaseInput->setPosition(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.75f)));
		m_releaseInput->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.1f)));
		m_releaseInput->setText("Release Input");


		m_statisticsWnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "StatisticsWnd");
	    root->addChildWindow(m_statisticsWnd);
		m_statisticsWnd->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
		m_statisticsWnd->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.15f)));
		m_statisticsWnd->setMaxSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.15f)));
		m_statisticsWnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
		m_statisticsWnd->setText("Statistics");
		m_statisticsWnd->hide();
		m_statisticsWnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&GUI::OnStatisticsClose, this));

		m_statisticsFPS = winMgr.createWindow("TaharezLook/StaticText", "Label4");
		m_statisticsWnd->addChildWindow(m_statisticsFPS);
		m_statisticsFPS->setProperty("FrameEnabled", "false");
		m_statisticsFPS->setProperty("BackgroundEnabled", "false");
		m_statisticsFPS->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.35f)));
		m_statisticsFPS->setSize(CEGUI::UVector2(cegui_reldim(0.7f), cegui_reldim( 0.2f)));
		m_statisticsFPS->setText("FPS : ");

		m_statisticsFaces = winMgr.createWindow("TaharezLook/StaticText", "Label5");
		m_statisticsWnd->addChildWindow(m_statisticsFaces);
		m_statisticsFaces->setProperty("FrameEnabled", "false");
		m_statisticsFaces->setProperty("BackgroundEnabled", "false");
		m_statisticsFaces->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.6f)));
		m_statisticsFaces->setSize(CEGUI::UVector2(cegui_reldim(0.7f), cegui_reldim( 0.2f)));
		m_statisticsFaces->setText("Faces : ");

		//credits
		m_creditsWnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "CreditsWnd");
	    root->addChildWindow(m_creditsWnd);
		m_creditsWnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
		m_creditsWnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
		m_creditsWnd->setMaxSize(CEGUI::UVector2(cegui_reldim(0.8f), cegui_reldim( 0.8f)));
		m_creditsWnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
		m_creditsWnd->setText("Credits");
		m_creditsWnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&GUI::OnCreditsClose, this));
		m_creditsWnd->hide();

		m_creditsText = (CEGUI::MultiLineEditbox*)winMgr.createWindow("TaharezLook/MultiLineEditbox", "CreditsText");
		m_creditsWnd->addChildWindow(m_creditsText);
		m_creditsText->setPosition(CEGUI::UVector2(cegui_reldim(0.025f), cegui_reldim( 0.12f)));
		m_creditsText->setSize(CEGUI::UVector2(cegui_reldim(0.95f), cegui_reldim( 0.86f)));
		m_creditsText->setMaxSize(CEGUI::UVector2(cegui_reldim(0.95f), cegui_reldim( 0.86f)));
		m_creditsText->setMinSize(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f)));
		m_creditsText->setText("Intel Game Demo Contest 2008\nKirill Kolodyazhniy\n");
		m_creditsText->setReadOnly(true);

	}
	/**********************************************************************************************************/
	void GUI::MouseMove(REAL x, REAL y)
	{
		CEGUI::System::getSingleton().injectMouseMove(static_cast<float>(x), static_cast<float>(y));
	}
	/**********************************************************************************************************/
	void GUI::MouseDown(InputSystem::MouseButton but)
	{
		CEGUI::System::getSingleton().injectMouseButtonDown(static_cast<CEGUI::MouseButton>(but));
	}
	/**********************************************************************************************************/
	void GUI::MouseUp(InputSystem::MouseButton but)
	{
		CEGUI::System::getSingleton().injectMouseButtonUp(static_cast<CEGUI::MouseButton>(but));
	}
	/**********************************************************************************************************/
	void GUI::MouseWheel(REAL val)
	{
		CEGUI::System::getSingleton().injectMouseWheelChange(static_cast<float>(val));
	}
	/**********************************************************************************************************/
	void GUI::KeyDown(unsigned int key)
	{
		CEGUI::System::getSingleton().injectKeyDown(key);
	}
	/**********************************************************************************************************/
	void GUI::KeyUp(unsigned int key)
	{
		CEGUI::System::getSingleton().injectKeyUp(key);
	}
	/**********************************************************************************************************/
	void GUI::CharPressed(unsigned short key)
	{
		CEGUI::System::getSingleton().injectChar(key);
	}
	/**********************************************************************************************************/
	void GUI::Render()
	{
		//update statistics
		if(m_statisticsWnd->isVisible())
		{
			std::stringstream buf;
			buf << "FPS : " << m_window->GetFPS();
			m_statisticsFPS->setText(buf.str());
			buf.str("");buf.clear();
			buf << "Faces : " << m_window->GetTriangleCount();
			m_statisticsFaces->setText(buf.str());
		}

		// draw GUI
		CEGUI::System::getSingleton().renderGUI();
	}
	/**********************************************************************************************************/
	void GUI::StartReset()
	{
		m_guiRenderer->preD3DReset();
	}
	/**********************************************************************************************************/
	void GUI::FinishReset()
	{
		m_guiRenderer->postD3DReset();
	}
	/**********************************************************************************************************/
	bool GUI::OnStartClick(const CEGUI::EventArgs&)
	{
		if(m_gameMenu)
			ResumeGameSignal();
		else
			StartGameSignal();

		m_startBtn->hide();
		m_optionsBtn->hide();
		m_quitBtn->hide();
		m_creditsBtn->hide();
		m_optionsWnd->hide();
		m_creditsWnd->hide();

		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnOptionsClick(const CEGUI::EventArgs&)
	{
		std::stringstream buf;
		buf << m_window->GetBufferWidth() << "x" << m_window->GetBufferHeight();
		m_optionsResCombo->setText(buf.str());

		buf.str("");buf.clear();
		buf << m_window->GetFSAAMode();
		m_optionsFSAACombo->setText(buf.str());

		m_optionsFullScr->setSelected(m_window->IsFullScreen());

		m_optionsShowStat->setSelected(m_statisticsWnd->isVisible());

		m_releaseInput->setSelected(!m_input->IsExclusive());

		m_optionsMultiT->setCurrentValue(static_cast<float>(ThreadPool::GetSingleton().GetThreadsNum() + 1));

		m_startBtn->hide();
		m_optionsBtn->hide();
		m_quitBtn->hide();
		m_creditsBtn->hide();
		m_optionsWnd->show();
		m_optionsWnd->setAlwaysOnTop(true);
		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnQuitClick(const CEGUI::EventArgs&)
	{
		return ExitGame();
	}
	/**********************************************************************************************************/
	bool GUI::ExitGame()
	{
		if(m_gameMenu)
		{
			m_gameMenu = false;
			ExitGameSignal();

			m_startBtn->setText("Start Game");
			m_startBtn->show();
			m_optionsBtn->show();
			m_quitBtn->setText("Quit");
			m_quitBtn->show();
			m_creditsBtn->show();
			m_optionsWnd->hide();
			m_creditsWnd->hide();
		}
		else
			QuitSignal();

		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnCreditsClick(const CEGUI::EventArgs&)
	{
		m_creditsWnd->show();
		m_creditsWnd->setAlwaysOnTop(true);
		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnOptionsOkClick(const CEGUI::EventArgs&)
	{
		std::stringstream buf(m_optionsResCombo->getText().c_str());
		std::stringstream buf2;
		unsigned int w = 0, h = 0;
		std::string strbuf;
		std::getline(buf, strbuf, 'x');
		buf2 << strbuf;
		buf2 >> w;
		std::getline(buf, strbuf, 'x');
		buf2.str("");buf2.clear();
		buf2 << strbuf;
		buf2 >> h;

		m_window->SetResolution(w,h);

		unsigned int fsaa = 0;
		buf.str(m_optionsFSAACombo->getText().c_str());
		buf.clear();
		buf >> fsaa;

		m_window->SetFSAAMode(fsaa);

		m_window->SetFullScreen(m_optionsFullScr->isSelected());

		ThreadPool::GetSingleton().SetThreadsNum(static_cast<unsigned int>(m_optionsMultiT->getCurrentValue()) - 1);

		if(m_optionsShowStat->isSelected())
		{
			m_statisticsWnd->setAlwaysOnTop(true);
			m_statisticsWnd->show();
		}
		else
		{
			m_statisticsWnd->hide();
		}

		if(m_releaseInput->isSelected())
		{
			if(m_input->IsExclusive())
				m_input->ToggleExclusive(false);
		}
		else
		{
			if(!m_input->IsExclusive())
				m_input->ToggleExclusive(true);
		}

		m_startBtn->show();
		m_optionsBtn->show();
		m_quitBtn->show();
		if(!m_gameMenu)
			m_creditsBtn->show();
		m_optionsWnd->hide();
		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnOptionsNoClick(const CEGUI::EventArgs&)
	{
		m_startBtn->show();
		m_optionsBtn->show();
		m_quitBtn->show();
		if(!m_gameMenu)
			m_creditsBtn->show();
		m_optionsWnd->hide();
		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnCreditsClose(const CEGUI::EventArgs&)
	{
		m_creditsWnd->hide();
		return true;
	}
	/**********************************************************************************************************/
	bool GUI::OnStatisticsClose(const CEGUI::EventArgs&)
	{
		m_statisticsWnd->hide();
		return true;
	}
	/**********************************************************************************************************/
	void GUI::ShowGameMenu()
	{
		m_gameMenu = true;
		m_startBtn->setText("Resume Game");
		m_startBtn->show();
		m_optionsBtn->show();
		m_quitBtn->setText("Exit Game");
		m_quitBtn->show();
		m_optionsWnd->hide();
	}
	/**********************************************************************************************************/
}
